package org.vison.wonfu.framework.codestyle.issue;

import java.io.File;

/**
 * 表示代码中发现的问题
 */
public class Issue {
    private final File file;
    private final int lineNumber;
    private final String ruleId;
    private final String message;
    private final Severity severity;
    
    public enum Severity {
        INFO, WARNING, ERROR
    }
    
    public Issue(File file, int lineNumber, String ruleId, String message, Severity severity) {
        this.file = file;
        this.lineNumber = lineNumber;
        this.ruleId = ruleId;
        this.message = message;
        this.severity = severity;
    }
    
    // Getters
    public File getFile() {
        return file;
    }
    
    public int getLineNumber() {
        return lineNumber;
    }
    
    public String getRuleId() {
        return ruleId;
    }
    
    public String getMessage() {
        return message;
    }
    
    public Severity getSeverity() {
        return severity;
    }
    
    @Override
    public String toString() {
        return String.format("[%s] %s:%d - %s (%s)", 
                severity, file.getName(), lineNumber, message, ruleId);
    }
}
